el().ready(function(){
	if(document.getElementById('productInfo')){
		moreinfo.rating();
		//moreinfo.productExtras('#prodAccessories');
		moreinfo.init();
		document.getElementById('moreinfoReadmoreLink').onclick = function(){
			document.getElementById('moreinfoReadmoreLink').style.display='none';
			document.getElementById('moreinfoDescHide').style.display='inline';
		}
	}
	
	/* Navigation */
	if(document.getElementById('searchOptions')){
		 Navigation.init({ 
			   ID:'searchOptions',
			   Effect:false,
			   Speed:1,
			   Jump:20,
			   Collapsed:Array('0:header collapsed','0:header collapsed'),
			   fn:function(list){
				   if(list.children[0].children[1].className == "close"){
				       list.children[0].children[1].className = "open";
					   list.children[0].style.background="#E6E7EC";
				   }else{
				       list.children[0].children[1].className = "close";
					   list.children[0].style.background="#FFF";
				   }
		   }});
	}
	
	/* Homepage Rotator */
	if(document.getElementById('homeadvert')){
		el().ajax({url:"/web3g/xml/homepageBanners.xml",format:"xml",complete:function(t,xmlDoc){
			
			var 
			i     = 0,
			total = 0,
			count = xmlDoc.getElementsByTagName('Banner').length,
			img   = xmlDoc.getElementsByTagName('Image'),
			lnk   = xmlDoc.getElementsByTagName('Link'),
			timer = xmlDoc.getElementsByTagName('Timer'),
			text  = xmlDoc.getElementsByTagName('Text');
			
			while(i < count){
				if(typeof parseInt(timer[i].childNodes[0].nodeValue) == "number"){
					total += parseInt(timer[i].childNodes[0].nodeValue);
					if(document.getElementById('hpAdvertText'+i+'')){
						document.getElementById('hpAdvertText'+i+'').href      = lnk[i].childNodes[0].nodeValue;
						document.getElementById('hpAdvertText'+i+'').innerHTML = text[i].childNodes[0].nodeValue;
					}
				}
				i++;
			}
			
			changeImg = function(img,lnk,i){
				if(document.getElementById('rotateID'))
				   document.getElementById('rotateID').src = img;
				if(document.getElementById('rotateIDLnk'))
					document.getElementById('rotateIDLnk').href=lnk;
				
				document.getElementById('hpAdvertText0').parentNode.style.background = "url('/images/flash/flash_right_00b.jpg')";
				document.getElementById('hpAdvertText1').parentNode.style.background = "url('/images/flash/flash_right_01b.jpg')";
				document.getElementById('hpAdvertText2').parentNode.style.background = "url('/images/flash/flash_right_02b.jpg')";
				
				document.getElementById('hpAdvertText'+i).parentNode.style.background= "url('/images/flash/flash_right_0"+i+"a.jpg')";
			}
			
			
			i=0;
			while(i<count){
				setTimeout("changeImg('"+img[i].childNodes[0].nodeValue+"','"+lnk[i].childNodes[0].nodeValue+"','"+i+"')",(parseInt(timer[i].childNodes[0].nodeValue)*i));
				i++;
			}
			
			setInterval(function(){
				i=0;
				while(i<count){
					setTimeout("changeImg('"+img[i].childNodes[0].nodeValue+"','"+lnk[i].childNodes[0].nodeValue+"','"+i+"')",(parseInt(timer[i].childNodes[0].nodeValue)*i));
					i++;
				}
			},total);
			
		}});
	}
});
/*el().ready(function(){
	var sO = document.getElementById('searchOptions').getElementsByTagName('a');
	for(var i in sO){
		if(typeof sO[i].href != "undefined"){
			
			sO[i].cache=sO[i].href.replace('search','productSearch');
			
			sO[i].href="javascript:el('#search').css('opacity',0).ajax({url:'"+sO[i].cache+"',overwrite:true,complete:function(){ el('#search').animate({property:'opacity',to:1,jump:0.05});}});";
			
		}
	}
	sO=null;
});*/